/**
 * Copyright 2016 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// DO NOT EDIT THIS GENERATED OUTPUT DIRECTLY!
// This file should be overwritten as part of your build process.
// If you need to extend the behavior of the generated service worker, the best approach is to write
// additional code and include it using the importScripts option:
//   https://github.com/GoogleChrome/sw-precache#importscripts-arraystring
//
// Alternatively, it's possible to make changes to the underlying template file and then use that as the
// new base for generating output, via the templateFilePath option:
//   https://github.com/GoogleChrome/sw-precache#templatefilepath-string
//
// If you go that route, make sure that whenever you update your sw-precache dependency, you reconcile any
// changes made to this original template file with your modified copy.

// This generated service worker JavaScript will precache your site's resources.
// The code needs to be saved in a .js file at the top-level of your site, and registered
// from your pages in order to be used. See
// https://github.com/googlechrome/sw-precache/blob/master/demo/app/js/service-worker-registration.js
// for an example of how you can register this script and handle various service worker events.

/* eslint-env worker, serviceworker */
/* eslint-disable indent, no-unused-vars, no-multiple-empty-lines, max-nested-callbacks, space-before-function-paren, quotes, comma-spacing */
'use strict';

var precacheConfig = [["/2014/03/22/vuejs-010-release/index.html", "5a20ac5a54fb6f152844546854edcc64"], ["/2014/07/29/vue-next/index.html", "c217a313c409fe41ffd0bdaca2a4ac27"], ["/2014/11/09/vue-011-release/index.html", "0d1a539c892707122b2dfa0ab6325304"], ["/2014/12/08/011-component/index.html", "8d5e04bb7e398f99e265c6797a401d27"], ["/2015/06/11/012-release/index.html", "a3bdcb20fdb681a939243bc302cbc54e"], ["/2015/10/26/1.0.0-release/index.html", "114a4392db8001c05792f119c8bd0617"], ["/2015/10/28/why-no-template-url/index.html", "f2e4e998c33f70ea3f4a633565f10179"], ["/2015/12/28/vue-cli/index.html", "d1cdcd89bebfe6dfd9dffe3650e7a394"], ["/2016/02/06/common-gotchas/index.html", "ef23c97ce8bbf1f9b715d1df1a554f79"], ["/2016/03/14/march-update/index.html", "34ab888c30e8f233a693d5bbe084824c"], ["/2016/04/27/announcing-2.0/index.html", "23854f2061700865b499dba23367ff98"], ["/about/guide.html", "63ac188565abb9d483153d006f4c1dfb"], ["/about/index.html", "0ce8ba5dcc0db3e2dfd6d307eddf3a9e"], ["/api/index.html", "176a72f4aaa42c3b6a404d370e87fbb8"], ["/archives/2014/03/index.html", "22f7a5b152ec855b20bdac65e220d11f"], ["/archives/2014/07/index.html", "3b958eca34213e4a5abbf509381a73cc"], ["/archives/2014/11/index.html", "adb4c0aaa06473eb0cff8db581592001"], ["/archives/2014/12/index.html", "b7037b964866bcc52b5afbfaaeee7c4c"], ["/archives/2014/index.html", "1c8fe5573340b9aadd60fe2b1a56f237"], ["/archives/2015/06/index.html", "71d3f470c9356f816a1f6b75cfc39f7e"], ["/archives/2015/10/index.html", "bf11f01fa7164b695eab36ba88c72735"], ["/archives/2015/12/index.html", "2239a1398c4be837dc3b1619a431106d"], ["/archives/2015/index.html", "1dbfe6d1a2e1e18fd89d1c88a99d710f"], ["/archives/2016/02/index.html", "f8268222fcea6efb7ea30accdc3e4176"], ["/archives/2016/03/index.html", "1ec50fe64fdc90697adc19e07c679e77"], ["/archives/2016/04/index.html", "3014167157f165ae7a8a37bba15cf04c"], ["/archives/2016/index.html", "716b4ced6af4f72d048311c48f3e7662"], ["/archives/index.html", "ec72ef691253a07f9f61ad5a8cf65331"], ["/archives/page/2/index.html", "fc19bf115147c8f5a5dc194be174b752"], ["/atom.xml", "1d5da6a48e87f04baabab6fe0d870215"], ["/browserconfig.xml", "a1327babc882f9875f57f5b367c9ffc9"], ["/css/benchmark.css", "b083e0006589a5ba88a250eb8ee12cc5"], ["/css/index.css", "bb2ee67a14c2a4910600d32bdfd6b6ff"], ["/css/page.css", "d01981f0b9d49ce2211b2bfd4bd5a8a9"], ["/css/search.css", "e4e6c1e2a49dfe73bd8f10ca3409c040"], ["/examples/commits.html", "3cd3b2db40187e7f2d236473bae9ce59"], ["/examples/elastic-header.html", "198f4c19911bf30785905adb996ef899"], ["/examples/firebase.html", "266080b80e262a2b93289d466d1337b5"], ["/examples/grid-component.html", "3119ba25bb6b9dcc2f40d3f60e2136df"], ["/examples/hackernews.html", "f793aeb8d340c60945b0a58f3afa25c9"], ["/examples/index.html", "dc91b34e726c12318c4d083a3090c156"], ["/examples/modal.html", "88b6a98ec8a44cd783eaf0d71fcf46a7"], ["/examples/select2.html", "b812ad3b215af513c979c0d9759fe5c9"], ["/examples/svg.html", "0a1876c72d22212d243ed8c2d5b0404e"], ["/examples/todomvc.html", "a048618225f78a66ff322bb1dde98a37"], ["/examples/tree-view.html", "4815e09c4b3af4132da0e95dc1fbc945"], ["/fonts/Dosis/Dosis-Medium.ttf", "1a7809b30cc0cb7fc96feb3cad2eefb7"], ["/fonts/Roboto_Mono/RobotoMono-Regular.ttf", "a48ac41620cd818c5020d0f4302489ff"], ["/fonts/Source_Sans_Pro/SourceSansPro-Light.ttf", "b2e90cc01cdd1e2e6f214d5cb2ae5c26"], ["/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf", "ba6cad25afe01d394e830f548a7f94df"], ["/fonts/Source_Sans_Pro/SourceSansPro-Semibold.ttf", "52984b3a4e09652a6feee711d5c169fd"], ["/guide/class-and-style.html", "a3174f2083dd58fbd1aa965dcc98133f"], ["/guide/comparison.html", "7c06634379b01b8e7ef0dfc90b9b8517"], ["/guide/components.html", "d98663b0d45a91f0a40541c1efe2bbfc"], ["/guide/computed.html", "3fcf408c7cdfd856ea75b6a5562ba8aa"], ["/guide/conditional.html", "896e19e7955f2616eb31ab4d8c65178c"], ["/guide/custom-directive.html", "697987fdd04783febdbff2aa2932c41d"], ["/guide/deployment.html", "be96515c673712671d042337366ddf63"], ["/guide/events.html", "0ebaec88003f2e1ab59ff868764d961a"], ["/guide/forms.html", "09ead2d35e42cdd09d848b27ec357491"], ["/guide/index.html", "e3171c7c94b236d5caa91894d8fdd581"], ["/guide/installation.html", "8acd1ab4fbaa082958259bf3a22d7b22"], ["/guide/instance.html", "61021765831307e8278d034c23502dd6"], ["/guide/join.html", "f2287c54050c9b576ed05af7baf6af73"], ["/guide/list.html", "772e05d65b4587501785906a4b681efd"], ["/guide/migration-vue-router.html", "e0d8a3e2dc09e2bda939c23c1e967765"], ["/guide/migration-vuex.html", "9b8659c8a4506acd24f2c0e3bee160f3"], ["/guide/migration.html", "af37d4bfb217e88a7f02eb92c446497f"], ["/guide/mixins.html", "270f751a44e1d1e18b9a31406a34fe8b"], ["/guide/plugins.html", "40467c9724e4917ae32582ac543db41b"], ["/guide/reactivity.html", "5b1e83c4a12b5f3e687e89e0a0b1ef05"], ["/guide/render-function.html", "4139dd80783f9eecb92d57dcf23dc54d"], ["/guide/routing.html", "f7f89a93550ee84e925ed84d6912a650"], ["/guide/single-file-components.html", "095eb3d7152439579d7a56227fe273f4"], ["/guide/ssr.html", "9143accd02c56349a3ec40d79eeefb4d"], ["/guide/state-management.html", "81ea6d4aee3ef538b507e4a5a0c3e3a0"], ["/guide/syntax.html", "611a256a910e0d1adfd5b418535e0ac1"], ["/guide/transitioning-state.html", "3f36248a3d9f6f21f10725f15775c5d6"], ["/guide/transitions.html", "4513c62165ee217697830a40e1795365"], ["/guide/unit-testing.html", "0f69c6b7a8d743af6384b8a2208b9a33"], ["/images/100offer-main.png", "8d37ff203f0818315e97516ae2e9f4ba"], ["/images/100offer.png", "5fc04cb5266c2171ce5cc68ca6be8ea4"], ["/images/2mhost.png", "4b8d618675f5ae2e25873930e0f1a33b"], ["/images/actualize.png", "caed3eca0208a349140a95b354d07382"], ["/images/chaitin.png", "2e90c7e1644d533624b59194544aab8b"], ["/images/check.png", "1ab55a9d7d368f9e185314b4ee3e108a"], ["/images/component_io.png", "62cc2842e0be59abcea55226b7b9f779"], ["/images/components.png", "c7b535e898bc597be0098040c2402f8b"], ["/images/data.png", "d777bbbf663f281783a84284ce7d3d18"], ["/images/deepstream.png", "2e6302d3d38d6e29da5e757edf42dedd"], ["/images/down.png", "39cee69a29f44c5ae8acacf0c7c0c9fe"], ["/images/famebroker.png", "50c05f70a13a6ccf44ebc50d6b97263c"], ["/images/fancygrid.png", "06f2ce38e8497841593455ca53e58623"], ["/images/feed.png", "fc48422363785bd7645699a57c9c9660"], ["/images/hn-architecture.png", "08daea42db8838ab4762f25b68dc743a"], ["/images/hn.png", "34849a03c242cc54b8fbab606902cbf3"], ["/images/htmlburger.png", "3c838f6dbddb1361e6019f521578171f"], ["/images/icons.png", "24c9ea5274c732f8ec0ee13fb2361313"], ["/images/icons/android-icon-144x144.png", "42d2c151cc101a4c42ac51bd96c8b24d"], ["/images/icons/android-icon-192x192.png", "ad7d1af025254f7fb6c45917d26c0486"], ["/images/icons/android-icon-36x36.png", "005fffcd0a3cce3dacf8856645501213"], ["/images/icons/android-icon-48x48.png", "e898ac737b264364a216e2007b1fd7da"], ["/images/icons/android-icon-72x72.png", "ad659ec7e8eae4a50b73145c69772d42"], ["/images/icons/android-icon-96x96.png", "90c13bf806fb3b3749ef1f60cc5dc34c"], ["/images/icons/apple-icon-114x114.png", "69c4653429d7ac74ef8b968ad0676a19"], ["/images/icons/apple-icon-120x120.png", "3bb7b09526b130a7713f247e7db6b835"], ["/images/icons/apple-icon-144x144.png", "42d2c151cc101a4c42ac51bd96c8b24d"], ["/images/icons/apple-icon-152x152.png", "6f0e515bd57131a7e9c584c0a99492c6"], ["/images/icons/apple-icon-180x180.png", "91bc1dd313b750413e8e54349d2d7feb"], ["/images/icons/apple-icon-57x57.png", "d322b29db86a269ca682d6d54450a6d1"], ["/images/icons/apple-icon-60x60.png", "99b633995d668a30d869843d322cb2d5"], ["/images/icons/apple-icon-72x72.png", "ad659ec7e8eae4a50b73145c69772d42"], ["/images/icons/apple-icon-76x76.png", "293bd080883b88e811ec54fd1d17f04c"], ["/images/icons/apple-icon-precomposed.png", "8366f4f77f84f5945d37c8b6b5e85466"], ["/images/icons/apple-icon.png", "8366f4f77f84f5945d37c8b6b5e85466"], ["/images/icons/favicon-16x16.png", "b0fb918340bdb38c3f82934c3b83da28"], ["/images/icons/favicon-32x32.png", "495a42102231b5a1e1999b969fe59ca9"], ["/images/icons/favicon-96x96.png", "90c13bf806fb3b3749ef1f60cc5dc34c"], ["/images/icons/ms-icon-144x144.png", "42d2c151cc101a4c42ac51bd96c8b24d"], ["/images/icons/ms-icon-150x150.png", "81b31836aa22a0861e979c3f798c2257"], ["/images/icons/ms-icon-310x310.png", "dc00a74758f465cf5545d759a7fc26fc"], ["/images/icons/ms-icon-70x70.png", "e20d096831d0fe142137fb69fd7c5915"], ["/images/itunescn.png", "ca4a777f3e67fda2fc0c703e5a0f3845"], ["/images/jsfiddle.png", "cdaaf61398b8ccde5fbfb28daab02dc2"], ["/images/juejin.png", "f8a801162a92753a9f69ee528ea72d81"], ["/images/laravel.png", "854ba2a1472cff4b73bbb98cc2bf6e74"], ["/images/lifecycle.png", "aaa1b52d4c397d884d73775189440dcd"], ["/images/logo.png", "c2a605fbc0e687b2e1b4b90a7c445cdd"], ["/images/menu.png", "f97c6cafce76896f725f56d22c33dc5d"], ["/images/monterail.png", "a1b2c43f5834a30140acf56a56ee3d7e"], ["/images/mvvm.png", "edd0080fb145315fbc96164c219fee7e"], ["/images/patreon.png", "c55a20c3dface37cde7d1534e243c9fe"], ["/images/paypal.png", "cdc87f756d415712f06c68dda7fa5f87"], ["/images/props-events.png", "27584e95845e262286d25c47d44e0979"], ["/images/search.png", "57bde6918157195ab105e3c5d0967dec"], ["/images/shuttleworth.png", "a511730065708edf9f15d5ca6518accc"], ["/images/someline.png", "2e05b0cfb1eaa734666dab9e5f92cea1"], ["/images/state.png", "c4265cfefa02351484110c3c8d2a623a"], ["/images/stdlib.png", "0c3292d4d501cfb819cf38e8324d9220"], ["/images/strikingly.png", "c220cba956cba87d47c972340ef872d1"], ["/images/tde.png", "dfd1f4c2d07907d379fc26e890827f14"], ["/images/tmvuejs2.png", "260af8aecb932915b0aff029550a80a4"], ["/images/transition.png", "ca34aef3910abf105dc112aa23026d54"], ["/images/trisoft.png", "2cfc914f05b223404cf753d9427373d0"], ["/images/upyun-large.png", "cd66170a5022b5c9444119e3fa5cb83a"], ["/images/upyun-main.jpg", "54d539ea772a02d69d71c290932e110b"], ["/images/upyun-main.png", "68598c69bad838c69b6a46674fd66f29"], ["/images/upyun-small.png", "7a42625327e1495cec13cbe25c7a200d"], ["/images/vue-component-with-preprocessors.png", "7288b0138807e76b63b20efcb73a1423"], ["/images/vue-component.png", "15bcfe9fb8601c7599b1b2d21364cddb"], ["/images/vuejobs.png", "e050f9a94eb0f893093529fcce61d707"], ["/images/vuejobs.svg", "c31e68ce1f2663afbe9655c368c6dd35"], ["/index.html", "bf6fd261ce23c7abafeb53e0697823e0"], ["/js/common.js", "032ee2f9aa89ac1352fda323c1f03d71"], ["/js/css.escape.js", "fe4db48c9e3f272a6d12cf1312de889e"], ["/js/smooth-scroll.min.js", "53a7fcc785e987d5ed08302f36de6653"], ["/js/vue.js", "ec1bf44f7a487c492f576f24f39ba3c7"], ["/js/vue.min.js", "32e8fb7bee1d87966ac43d6b8ade3274"], ["/manifest.json", "bd8de9895abf2cc1faa760a8bd1004d8"], ["/menu/index.html", "0b75589924439ec467e0f23ed7f47dba"], ["/page/2/index.html", "91c42e1a4316464ababf98d23df76004"], ["/support-vuejs/index.html", "a2123d8d25f15744f32bbf1b3ea9b5fa"], ["/v2/api/index.html", "be593965d65d807996b527c31ada0d4c"], ["/v2/cookbook/adding-instance-properties.html", "aca339a452a777e90ec33b8f80f9f61c"], ["/v2/cookbook/index.html", "92cde5253da52c6e30e5863b939a449b"], ["/v2/examples/commits.html", "a58b68ef1dbf6d26fd577df4481324de"], ["/v2/examples/deepstream.html", "78a25f2afffa7612af8678c563a77cdd"], ["/v2/examples/elastic-header.html", "dfae21ec8b9810f016e62b21c4dcb84b"], ["/v2/examples/firebase.html", "e0ae778e5359e00639fca2ccc2f3bbb6"], ["/v2/examples/grid-component.html", "e6cc9b1096b9fdae68930e33d239ec7a"], ["/v2/examples/hackernews.html", "ab7ac33d4e5d4d5f2109c445037003ac"], ["/v2/examples/index.html", "7e8676ff1c95ff919c4ce1530e842248"], ["/v2/examples/modal.html", "e80a3a5a1edb2c864747692388cef681"], ["/v2/examples/select2.html", "46b78119b040fb55671422c414f12b1f"], ["/v2/examples/svg.html", "106d85566c133794ca9f5179bf65b28c"], ["/v2/examples/todomvc.html", "ada0dd409ce3969642ec6b73718f3337"], ["/v2/examples/tree-view.html", "3a5db6e73377b04cf6bda34f69ce57f6"], ["/v2/guide/class-and-style.html", "74007256912b9df4db84998f0999b332"], ["/v2/guide/comparison.html", "220c3d7d6fe41be8ee8fa0b28f40eaf8"], ["/v2/guide/components.html", "6c6f6a97a35bc79ccf292c302e8f9c42"], ["/v2/guide/computed.html", "441eefc1edd5979e49f08539d4c23303"], ["/v2/guide/conditional.html", "55a85f5d8eab9862265025e4365b4bdb"], ["/v2/guide/custom-directive.html", "5ee2c8f15e8b855485d8c95fcd5624ab"], ["/v2/guide/deployment.html", "92b118c5fda77ec72bb33b2607cee545"], ["/v2/guide/events.html", "6c835fd27d1c4b4caa97c07e9c585a0d"], ["/v2/guide/forms.html", "9b05d2bc132e0b09ac9cef0e1af635b4"], ["/v2/guide/index.html", "2e44d8f748e556979cd654a5f868e7f1"], ["/v2/guide/installation.html", "55da550fb2271128bb058096ebdd0677"], ["/v2/guide/instance.html", "0f7b919bdfdc35f4183180094bc4ea4a"], ["/v2/guide/join.html", "4bf8e0d81c3618462246556aa33ae4d5"], ["/v2/guide/list.html", "e1dfe228dd0a7591140e36b8d1dac275"], ["/v2/guide/migration-vue-router.html", "ba522a67a67f3eb1b0fff3cb8433e5e9"], ["/v2/guide/migration-vuex.html", "bff705887bbdfdf3bf76149c2b31fb25"], ["/v2/guide/migration.html", "3877f5495e9525131ca90890af3b827f"], ["/v2/guide/mixins.html", "a28c934371f12538b25273fee5485bc5"], ["/v2/guide/plugins.html", "af7b8818a3af756e370b437b1ad8bf98"], ["/v2/guide/reactivity.html", "180068fef13cb8761989cb30e0b6132d"], ["/v2/guide/render-function.html", "d3b54629482f5f41ed0aa0327eacf360"], ["/v2/guide/routing.html", "1245b1e864f3ea1a8cb16d04d62a9efb"], ["/v2/guide/single-file-components.html", "f8addac395b69c0b814126240f8d766e"], ["/v2/guide/ssr.html", "9f73e1db58563d0327c62eb26f97428d"], ["/v2/guide/state-management.html", "a3e6df1d61582b902deca0a6a5d553ce"], ["/v2/guide/syntax.html", "6d37485f761ade46f3e8681b05b24cbf"], ["/v2/guide/team.html", "b695871a802b86ab4bbaa8ba4bdb4f81"], ["/v2/guide/transitioning-state.html", "3b8739450e2452447ebe438ff95c8de7"], ["/v2/guide/transitions.html", "464d36332fef66f1991442012f0c3aa4"], ["/v2/guide/typescript.html", "8742ff93c91c072a45909b047cd0a1f8"], ["/v2/guide/unit-testing.html", "d01caa3f4a86a82f8e14ec5409d48a83"]];
var cacheName = 'sw-precache-v3--' + (self.registration ? self.registration.scope : '');


var ignoreUrlParametersMatching = [/^utm_/];


var addDirectoryIndex = function (originalUrl, index) {
    var url = new URL(originalUrl);
    if (url.pathname.slice(-1) === '/') {
        url.pathname += index;
    }
    return url.toString();
};

var cleanResponse = function (originalResponse) {
    // If this is not a redirected response, then we don't have to do anything.
    if (!originalResponse.redirected) {
        return Promise.resolve(originalResponse);
    }

    // Firefox 50 and below doesn't support the Response.body stream, so we may
    // need to read the entire body to memory as a Blob.
    var bodyPromise = 'body' in originalResponse ?
        Promise.resolve(originalResponse.body) :
        originalResponse.blob();

    return bodyPromise.then(function (body) {
        // new Response() is happy when passed either a stream or a Blob.
        return new Response(body, {
            headers: originalResponse.headers,
            status: originalResponse.status,
            statusText: originalResponse.statusText
        });
    });
};

var createCacheKey = function (originalUrl, paramName, paramValue,
                               dontCacheBustUrlsMatching) {
    // Create a new URL object to avoid modifying originalUrl.
    var url = new URL(originalUrl);

    // If dontCacheBustUrlsMatching is not set, or if we don't have a match,
    // then add in the extra cache-busting URL parameter.
    if (!dontCacheBustUrlsMatching ||
        !(url.pathname.match(dontCacheBustUrlsMatching))) {
        url.search += (url.search ? '&' : '') +
            encodeURIComponent(paramName) + '=' + encodeURIComponent(paramValue);
    }

    return url.toString();
};

var isPathWhitelisted = function (whitelist, absoluteUrlString) {
    // If the whitelist is empty, then consider all URLs to be whitelisted.
    if (whitelist.length === 0) {
        return true;
    }

    // Otherwise compare each path regex to the path of the URL passed in.
    var path = (new URL(absoluteUrlString)).pathname;
    return whitelist.some(function (whitelistedPathRegex) {
        return path.match(whitelistedPathRegex);
    });
};

var stripIgnoredUrlParameters = function (originalUrl,
                                          ignoreUrlParametersMatching) {
    var url = new URL(originalUrl);
    // Remove the hash; see https://github.com/GoogleChrome/sw-precache/issues/290
    url.hash = '';

    url.search = url.search.slice(1) // Exclude initial '?'
        .split('&') // Split into an array of 'key=value' strings
        .map(function (kv) {
            return kv.split('='); // Split each 'key=value' string into a [key, value] array
        })
        .filter(function (kv) {
            return ignoreUrlParametersMatching.every(function (ignoredRegex) {
                return !ignoredRegex.test(kv[0]); // Return true iff the key doesn't match any of the regexes.
            });
        })
        .map(function (kv) {
            return kv.join('='); // Join each [key, value] array into a 'key=value' string
        })
        .join('&'); // Join the array of 'key=value' strings into a string with '&' in between each

    return url.toString();
};


var hashParamName = '_sw-precache';
var urlsToCacheKeys = new Map(
    precacheConfig.map(function (item) {
        var relativeUrl = item[0];
        var hash = item[1];
        var absoluteUrl = new URL(relativeUrl, self.location);
        var cacheKey = createCacheKey(absoluteUrl, hashParamName, hash, false);
        return [absoluteUrl.toString(), cacheKey];
    })
);

function setOfCachedUrls(cache) {
    return cache.keys().then(function (requests) {
        return requests.map(function (request) {
            return request.url;
        });
    }).then(function (urls) {
        return new Set(urls);
    });
}

self.addEventListener('install', function (event) {
    event.waitUntil(
        caches.open(cacheName).then(function (cache) {
            return setOfCachedUrls(cache).then(function (cachedUrls) {
                return Promise.all(
                    Array.from(urlsToCacheKeys.values()).map(function (cacheKey) {
                        // If we don't have a key matching url in the cache already, add it.
                        if (!cachedUrls.has(cacheKey)) {
                            var request = new Request(cacheKey, {credentials: 'same-origin'});
                            return fetch(request).then(function (response) {
                                // Bail out of installation unless we get back a 200 OK for
                                // every request.
                                if (!response.ok) {
                                    throw new Error('Request for ' + cacheKey + ' returned a ' +
                                        'response with status ' + response.status);
                                }

                                return cleanResponse(response).then(function (responseToCache) {
                                    return cache.put(cacheKey, responseToCache);
                                });
                            });
                        }
                    })
                );
            });
        }).then(function () {

            // Force the SW to transition from installing -> active state
            return self.skipWaiting();

        })
    );
});

self.addEventListener('activate', function (event) {
    var setOfExpectedUrls = new Set(urlsToCacheKeys.values());

    event.waitUntil(
        caches.open(cacheName).then(function (cache) {
            return cache.keys().then(function (existingRequests) {
                return Promise.all(
                    existingRequests.map(function (existingRequest) {
                        if (!setOfExpectedUrls.has(existingRequest.url)) {
                            return cache.delete(existingRequest);
                        }
                    })
                );
            });
        }).then(function () {

            return self.clients.claim();

        })
    );
});


self.addEventListener('fetch', function (event) {
    if (event.request.method === 'GET') {
        // Should we call event.respondWith() inside this fetch event handler?
        // This needs to be determined synchronously, which will give other fetch
        // handlers a chance to handle the request if need be.
        var shouldRespond;

        // First, remove all the ignored parameters and hash fragment, and see if we
        // have that URL in our cache. If so, great! shouldRespond will be true.
        var url = stripIgnoredUrlParameters(event.request.url, ignoreUrlParametersMatching);
        shouldRespond = urlsToCacheKeys.has(url);

        // If shouldRespond is false, check again, this time with 'index.html'
        // (or whatever the directoryIndex option is set to) at the end.
        var directoryIndex = 'index.html';
        if (!shouldRespond && directoryIndex) {
            url = addDirectoryIndex(url, directoryIndex);
            shouldRespond = urlsToCacheKeys.has(url);
        }

        // If shouldRespond is still false, check to see if this is a navigation
        // request, and if so, whether the URL matches navigateFallbackWhitelist.
        var navigateFallback = '';
        if (!shouldRespond &&
            navigateFallback &&
            (event.request.mode === 'navigate') &&
            isPathWhitelisted([], event.request.url)) {
            url = new URL(navigateFallback, self.location).toString();
            shouldRespond = urlsToCacheKeys.has(url);
        }

        // If shouldRespond was set to true at any point, then call
        // event.respondWith(), using the appropriate cache key.
        if (shouldRespond) {
            event.respondWith(
                caches.open(cacheName).then(function (cache) {
                    return cache.match(urlsToCacheKeys.get(url)).then(function (response) {
                        if (response) {
                            return response;
                        }
                        throw Error('The cached response that was expected is missing.');
                    });
                }).catch(function (e) {
                    // Fall back to just fetch()ing the request if some unexpected error
                    // prevented the cached response from being valid.
                    console.warn('Couldn\'t serve response for "%s" from cache: %O', event.request.url, e);
                    return fetch(event.request);
                })
            );
        }
    }
});



